import com.bigmi.common.baidu.api.CheckContent;
import com.bigmi.file.service.FileStorageService;
import com.bigmi.wemedia.WemediaApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;

@SpringBootTest(classes = WemediaApplication.class)
@RunWith(SpringRunner.class)
public class baiduTest2 {
    @Autowired
    private CheckContent checkContent;

    @Autowired
    private FileStorageService fileStorageService;

    @Test
    public  void testScanText()  {
        Map<String, Object> map = checkContent.TextCensor("张发星大shabi");
        Object conclusionType = map.get("conclusionType");
        System.out.println(conclusionType+"==========");
        Object conclusion = map.get("conclusion");
        System.out.println("++++++++++++++"+conclusion);
        if (map.get("conclusion").equals("不合规")){
            System.out.println(conclusion+"123456测试成功");
        }
        System.out.println("================="+map);
    }
    @Test
    public void imgScanText(){
//        List<String> images =new LinkedList<>();
//        images.add("http://192.168.37.134:9000/bigminews/2023/02/27/c14ed569 1c70 4c3b bff7 f107180dd8a4.jpg");
//        images.add("http://192.168.37.134:9000/bigminews/2023/02/23/20abf9fb 50d7 4092 923e 2d2e883d97ce.png");
        String image="http://192.168.37.134:9000/bigminews/2023/02/23/20abf9fb 50d7 4092 923e 2d2e883d97ce.png";
        /*byte[] bytes = fileStorageService.downLoadFile("");
        for (String image : images) {
            fileStorageService.downLoadFile(image);
            Map<String, Object> map = checkContent.ImgCensor(bytes);
            System.out.println(map);
        }*/
        byte[] bytes = fileStorageService.downLoadFile(image);
        Map<String, Object> map = checkContent.ImgCensor(bytes);
        System.out.println(map);
    }
}
